﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace MainConsoleService.Common
{
    public class WriteSysLog 
    {
        private static readonly string logPath = AppDomain.CurrentDomain.BaseDirectory;
        

        /// <summary>
        /// 记录日志
        /// </summary>
        /// <param name="fileName">文件名</param>
        /// <param name="errmessage">日志信息</param>
        public static void Log(string fileName,string errmessage)
        {
            File.AppendAllText(string.Format("{0}\\log\\{1}.txt",logPath ,fileName), errmessage,
                               Encoding.UTF8);
        }

        /// <summary>
        /// 保存物流信息
        /// </summary>
        /// <param name="fileName">文件名</param>
        /// <param name="logistInfo">物流信息</param>
        public static void SaveLogist(string fileName, string logistInfo)
        {
            File.AppendAllText(string.Format("{0}\\log\\{1}.txt", logPath, fileName), logistInfo,
                               Encoding.UTF8);
        }
    }
}